BUILD_NAME := hardware_test

GOSRC := ./main.go

TARGET_DIR := ./

GO=/usr/local/go/bin/go
GOPATH=/home/wml/go
GO_LDFLAGS="\
	-X 'main.version=$(shell $(GO) version)' \
	-X 'cloud_chint/utils/common.BuildDate=$(shell date +'%Y-%m-%d %H:%M:%S')' \
	-X 'main.gitBranch=$(shell git rev-parse --abbrev-ref HEAD)' \
	-X 'main.gitCommit=$(shell git rev-parse HEAD)' \
	-X 'main.gitVersion=$(shell git describe --always --tags --long)' \
	-X 'cloud_chint/utils/common.AppVersion=$(shell git describe --always --tags --long |sed -E 's/.*([vV][0-9]+\.[0-9]+\.[0-9]+).*/\1/')'"


host:
	go build -ldflags ${GO_LDFLAGS} -o ${TARGET_DIR}${BUILD_NAME} ${GOSRC}

arm:
	GOARCH=arm64 go build -ldflags ${GO_LDFLAGS} -o ${TARGET_DIR}${BUILD_NAME} ${GOSRC}

clean:
	rm ${TARGET_DIR}${BUILD_NAME} -f

.PHONY : host arm clean install
